#!/bin/bash
fromcolor="$1"
tocolor="$2"
if [[ -z "$fromcolor" || -z "$tocolor" ]]; then
    echo "Please specify colors."
    exit 1
else
    find . -type f -name '*.svg' -print0 | while IFS= read -r -d '' file; do
        if [[ `grep "$fromcolor" "$file"` ]]; then
            echo "Replacing $fromcolor with $tocolor in $file"
            sed -i "s/$fromcolor/$tocolor/g" "$file"
        fi
    done
fi
